#pragma once
#define OPENEXR_DLL

//#undef min
//#undef max
//#undef ASSERT
//#undef THROW

#include <ImfOutputFile.h>
#include <ImfInputFile.h>
#include <ImfRgbaFile.h>
#include <ImfChannelList.h>
#include <ImfStringAttribute.h>
#include <ImfMatrixAttribute.h>
#include <ImfArray.h>
#include <Iex.h>
#include <half.h>

//using namespace Imf;
//using namespace Imath;

#include "d3d/D3DUtilityFunction.h"

class CExrFileIO
{
public:
	CExrFileIO(void);
	virtual ~CExrFileIO(void);

	void LoadExrFile(char* strFileName);
	void SaveExrFile(char* strFileName, Imf::RgbaChannels iChannels = Imf::WRITE_RGB);
	void FillPixelsArray(const double* arrInput2dData, const unsigned int iBufWidth, const unsigned int iBufHeight, const double fScaleRange, bool bColor = true);

	inline int GetImgWidth() {return m_iImgWidth;}
	inline int GetImgHeight() {return m_iImgHeight;}
protected:
	Imf::Array2D<Imf::Rgba> m_arrPixels;
	int m_iImgWidth;
	int m_iImgHeight;
};

